home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / prof / sun3.md / profInt.h < prev    next >
C/C++ Source or Header  |  1990-09-11  |  2KB  |  87 lines

  1. /*
  2.  * profInt.h --
  3.  *
  4.  *    Internal declarations of the profile module.
  5.  *
  6.  * Copyright 1986 Regents of the University of California
  7.  * All rights reserved.
  8.  *
  9.  *
  10.  * $Header: /sprite/src/kernel/prof/sun3.md/RCS/profInt.h,v 9.1 90/09/11 12:08:22 rab Exp $ SPRITE (Berkeley)
  11.  */
  12.  
  13. #ifndef _PROFINT
  14. #define _PROFINT
  15.  
  16. /*
  17.  * Forward declarations
  18.  */
  19.  
  20. extern void mcount _ARGS_((void)); 
  21. extern unsigned int Prof_ThisFP _ARGS_ ((void));
  22. extern unsigned int Prof_CallerFP _ARGS_ ((void));
  23. extern unsigned int Prof_NextFP _ARGS_ ((void));
  24. extern unsigned int Prof_ThisPC _ARGS_ ((unsigned int fp));
  25.  
  26. /*
  27.  * A histogram of PC samples is kept for use by gprof.
  28.  * Each sample is a counter that gets incremented when
  29.  * the PC is in the range for the counter.  The PC's are
  30.  * clustered in groups of 1, 2, 4, 8... values and there
  31.  * is a counter for each group.  A groupsize of 1 means there
  32.  * is a counter for every possible PC value.  The even sizes of
  33.  * the groups lets us generate the index into the array of counters
  34.  * by shifting.  (The about to shift also takes into account the
  35.  * size of an instruction, it averages that to two bytes!)
  36.  */
  37.  
  38. #define PROF_PC_GROUP_SIZE    2
  39. #define PROF_GROUP_SHIFT    1
  40. #define PROF_ARC_GROUP_SHIFT    2
  41. #define PROF_INSTR_SIZE_SHIFT    1
  42. #define PROF_PC_SHIFT        (PROF_GROUP_SHIFT + PROF_INSTR_SIZE_SHIFT)
  43.  
  44. /*
  45.  * Storage is set aside to hold call graph arc execution counts.
  46.  * The number of arcs stored is the number of instruction in the
  47.  * kernel divided by CALL_RATIO. ie. This represents the proportion
  48.  * of the instructions that are calls.
  49.  */
  50.  
  51. #define PROF_CALL_RATIO     8
  52.  
  53. /*
  54.  * A raw call graph arc just includes the callee's PC and the number of
  55.  * times the arc was executed.  The caller of the arc is the index of the
  56.  * arcIndex index shifted by PROF_ARC_SHIFT.
  57.  */
  58. #define PROF_ARC_GROUP_SHIFT    2
  59. #define PROF_ARC_SHIFT        (PROF_ARC_GROUP_SHIFT + PROF_INSTR_SIZE_SHIFT)
  60. typedef struct ProfRawArc {
  61.     int    calleePC;
  62.     int    count;
  63.     struct ProfRawArc *link;
  64. } ProfRawArc;
  65.  
  66. typedef struct ProfArc {
  67.     int    callerPC;
  68.     int    calleePC;
  69.     int    count;
  70. } ProfArc;
  71.  
  72. extern int        profArcListSize;
  73. extern ProfRawArc    *profArcList;
  74. extern ProfRawArc    *profArcListFreePtr;
  75. extern ProfRawArc    *profArcListEndPtr;
  76.  
  77. extern int        profArcIndexSize;
  78. extern ProfRawArc    **profArcIndex;
  79.  
  80. /*
  81.  * An of/off switch for profiling.
  82.  */
  83.  
  84. extern Boolean profEnabled;
  85.  
  86. #endif /* _PROFINT */
  87.